package springboot.file.demo.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author: jxm
 * @Description:
 * @Date: 2022/4/20 14:43
 * @Version: 1.0
 */
public class TimeUtils {

    /**
     * 返回当天时间字符串(yyyyMMdd)
     */
    public static String getCurrDate() {
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
        return df.format(new Date());
    }

    /**
     * 返回当天时间字符串(yyyyMMddHHmmss)
     */
    public static String getCurrDateTime() {
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
        return df.format(new Date());
    }

    public static void main(String[] args) {
        System.out.println(getCurrDateTime());
    }
}
